import { getAllDepartmentsMock, getAllRolesMock } from '@/service/main/system/role'
import { defineStore } from 'pinia'

interface IRoleState {
  allRoles: any[]
  allDepartments: any[]
}

const useRoleStore = defineStore('role', {
  state: (): IRoleState => {
    return {
      allRoles: [],
      allDepartments: []
    }
  },
  actions: {
    async getAllRoles() {
      const res = await getAllRolesMock()
      this.allRoles = res.data
      const res2 = await getAllDepartmentsMock()
      this.allDepartments = res2.data
    }
  }
})

export default useRoleStore
